<cfcomponent>

	<cffunction name="init" access="public" output="false" returntype="KalendarRequest" hint="I initialize this component">
		<cfargument name="View" type="string" default="" />
		<cfargument name="LinkDate" type="string" default="" />
		<cfargument name="CategoryID" type="string" default="" />
		<cfargument name="ReturnedEvents" type="array" default="#ArrayNew(1)#" />
		<cfargument name="CategoriesRS" type="any" default="" />
		<cfset setView( arguments.View ) />
		<cfset setLinkDate( arguments.LinkDate ) />
		<cfset setCategoryID( arguments.CategoryID ) />
		<cfset setReturnedEvents( arguments.ReturnedEvents ) />
		<cfset setCategoriesRS( arguments.CategoriesRS ) />
		<cfreturn this />
		
	</cffunction>

	
	<cffunction name="getView" access="public" output="false" returntype="string">
		<cfif listFindNoCase( getKalendarConfig().getValidViewList(), variables.instance.View ) >
			<cfreturn variables.instance.View />
		</cfif>
			
		<cfreturn getKalendarConfig().getDefaultView() />
			
	</cffunction>
	
	<cffunction name="getInternalView" access="public" output="false" returntype="string">
		<cfset rtnVal = getKalendarConfig().getDefaultView() />

		<cfif listFindNoCase( getKalendarConfig().getValidViewList(), variables.instance.View ) >
			<cfif variables.instance.View IS "list" >
				<cfset rtnVal = "month" />
			</cfif>
			<cfif variables.instance.View IS "weeklist">
				<cfset rtnVal = "week" />
			</cfif>
		</cfif>
			
		<cfreturn rtnVal />
			
	</cffunction>
	
	
	
	<cffunction name="setView" access="public" output="false" returntype="void">
		<cfargument name="View" type="string" required="true" />
		<cfset variables.instance.View = arguments.View />
	</cffunction>
	
	<cffunction name="getLinkDate" access="public" output="false" returntype="string">
		<cfreturn variables.instance.LinkDate />
	</cffunction>
	
	<cffunction name="setLinkDate" access="public" output="false" returntype="void">
		<cfargument name="LinkDate" type="string" required="true" />
		<cfset variables.instance.LinkDate = arguments.LinkDate />
	</cffunction>
	
	<cffunction name="getLongLinkDate" access="public" output="false" returntype="string">
		<cfset var rtnVal = "" />
		<cfif isDate( getLinkDate() ) >
			<cfset rtnVal = dateformat( getLinkDate(), getKalendarConfig().getLongDateMask() ) />	
		</cfif>
		
		<cfreturn rtnVal />
		
	</cffunction>
	
	<cffunction name="getShortLinkDate" access="public" output="false" returntype="string">
		<cfset var rtnVal = "" />
		<cfif isDate( getLinkDate() ) >
			<cfset rtnVal = dateformat( getLinkDate(), getKalendarConfig().getShortDateMask() ) />	
		</cfif>
		
		<cfreturn rtnVal />
		
	</cffunction>
	
	<cffunction name="getDBFormatLinkDate" access="public" output="false" returntype="string">
		<cfset var rtnVal = "" />
		<cfif isDate( getLinkDate() ) >
			<cfset rtnVal = CreateODBCDate( getLinkDate() ) />	
		</cfif>
		
		<cfreturn rtnVal />
		
	</cffunction>
	
	<cffunction name="getCategoryID" access="public" output="false" returntype="string">
			<cfreturn val(variables.instance.CategoryID) />
	</cffunction>
	
	<cffunction name="setCategoryID" access="public" output="false" returntype="void">
		<cfargument name="CategoryID" type="string" required="true" />
		<cfset variables.instance.CategoryID = arguments.CategoryID />
	</cffunction>	
	
	<cffunction name="getReturnedEvents" access="public" output="false" returntype="array">
		<cfreturn variables.instance.ReturnedEvents />
	</cffunction>
	
	<cffunction name="setReturnedEvents" access="public" output="false" returntype="void">
		<cfargument name="ReturnedEvents" type="array" required="true" />
		<cfset variables.instance.ReturnedEvents = arguments.ReturnedEvents />
	</cffunction>
	
	<!---  Usage: GetCategoriesRS / SetCategoriesRS  methods for CategoriesRS value --->
	<cffunction name="getCategoriesRS" access="public" output="false" returntype="any">
		<cfreturn variables.instance.CategoriesRS />
	</cffunction>
	
	<cffunction name="setCategoriesRS" access="public" output="false" returntype="void">
		<cfargument name="CategoriesRS" type="any" required="true" />
		<cfset variables.instance.CategoriesRS = arguments.CategoriesRS />
	</cffunction>
	
	<cffunction name="getKalendarConfig" access="public" output="false" returntype="any">
		<cfreturn variables.instance.KalendarConfig />
	</cffunction>
	
	<cffunction name="setKalendarConfig" access="public" output="false" returntype="void">
		<cfargument name="KalendarConfig" type="any" required="true" />
		<cfset variables.instance.KalendarConfig = arguments.KalendarConfig />
	</cffunction>


</cfcomponent>